<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->


<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-cn" xml:lang="zh-cn">
<head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="DC.Type" content="topic">
<meta name="DC.Title" content="应用一致性备份的生产环境Pod配置（容器应用为openGauss）">
<meta name="product" content="">
<meta name="DC.Relation" scheme="URI" content="kubernetes_CSI_00062.html">
<meta name="prodname" content="">
<meta name="version" content="">
<meta name="brand" content="30-OceanProtect 备份一体机 1.5.0-1.6.0 帮助中心">
<meta name="DC.Publisher" content="20240320">
<meta name="prodname" content="csbs">
<meta name="documenttype" content="usermanual">
<meta name="DC.Format" content="XHTML">
<meta name="DC.Identifier" content="kubernetes_CSI_00068">
<meta name="DC.Language" content="zh-cn">
<link rel="stylesheet" type="text/css" href="public_sys-resources/commonltr.css">
<title>应用一致性备份的生产环境Pod配置（容器应用为openGauss）</title>
</head>
<body style="clear:both; padding-left:10px; padding-top:5px; padding-right:5px; padding-bottom:5px"><a name="kubernetes_CSI_00068"></a><a name="kubernetes_CSI_00068"></a>

<h1 class="topictitle1">应用一致性备份的生产环境Pod配置（容器应用为openGauss）</h1>
<div><div class="section"><h4 class="sectiontitle">脚本示例</h4><p>openGauss前置命令脚本的内容示例如下，默认不配置后置命令的Pod注解，“/usr/local/opengauss/bin”为openGauss安装位置，“/usr/local/opengauss/lib”为openGauss的lib目录位置，用户可根据实际变量值输入。</p>
<pre class="screen">su - omm -c 'export PATH=<em>/usr/local/opengauss/bin</em>:$PATH &amp;&amp; export LD_LIBRARY_PATH=<em>/usr/local/opengauss/lib</em>:$LD_LIBRARY_PATH  &amp;&amp; gsql -c "checkpoint;"'</pre>
</div>
<div class="section"><h4 class="sectiontitle">操作步骤</h4><ol><li><span>将脚本上传至容器的任意持久化目录中并在容器界面为脚本文件添加权限。</span><p><div class="p">可通过在Kubernetes任意已配置kubectl工具的节点执行以下命令进入容器界面（此步骤及后续步骤以Pod名称“opengauss-deployment-0000-a1”，命名空间名称“ns-og”作为示例说明，请根据实际变量值输入）。<pre class="screen">kubectl exec -it <em>opengauss-deployment-0000-a1</em> -n <em>ns-og</em>  -- bash</pre>
</div>
<p>执行以下命令为脚本添加权限（此步骤及后续步骤以脚本位置在“/root/checkpoint.sh”为例说明，请根据实际脚本位置输入）。</p>
<pre class="screen">chmod +x /root/checkpoint.sh</pre>
</p></li><li><span>参见<a href="kubernetes_CSI_00066.html">应用一致性备份的生产环境Pod配置（通用）</a>添加Pod标签，命令示例如下。</span><p><pre class="screen">kubectl label pod <em>opengauss-deployment-0000-a1</em><em> </em>-n <em>ns-og</em> hook.dataprotect.backup.io/switch='on'</pre>
</p></li><li><span>执行以下命令添加Pod注解（此处默认执行前置命令容器为第一个容器，设置其他容器执行前置命令请参见<a href="kubernetes_CSI_00066.html">应用一致性备份的生产环境Pod配置（通用）</a>）。</span><p><pre class="screen">kubectl annotate pod <em>opengauss-deployment-0000-a1</em> -n <em>ns-og</em> pre.hook.dataprotect.backup.io/command='["/bin/sh", "-c","/root/checkpoint.sh"]' --overwrite</pre>
</p></li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>父主题：</strong> <a href="kubernetes_CSI_00062.html">常见问题</a></div>
</div>
</div>

<div class="hrcopyright"><hr size="2"></div><div class="hwcopyright">版权所有 &copy; 华为技术有限公司</div></body>
</html>